package com.rzjm.exercise.module.service.impl;

import com.rzjm.exercise.common.base.service.impl.BaseServiceImpl;
import com.rzjm.exercise.module.dao.ShopDao;
import com.rzjm.exercise.module.dao.UserShopRelationDao;
import com.rzjm.exercise.module.domain.Shop;
import com.rzjm.exercise.module.domain.UserShopRelation;
import com.rzjm.exercise.module.service.ShopService;
import com.rzjm.exercise.module.service.UserShopRelationService;
import com.rzjm.exercise.sys.system.user.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Handler;


@Service
public class UserShopRelationServiceImpl extends BaseServiceImpl<UserShopRelationDao, UserShopRelation> implements UserShopRelationService {

    @Resource
    private UserShopRelationDao relationDao;
    @Resource
    private UserDao userDao;
    @Resource
    private ShopDao shopDao;

    @Override
    public boolean isHasThisWx(Integer userId, Integer shopId) {
        Map<String,Object> map = new HashMap<>();
        map.put("id",shopId);
        map.put("sys_user_id",userId);
        List<Shop> list = shopDao.getPageByUserId(map);
        if(list!=null){
            if(list.size() > 0){
                return true;
            }
        }
        return false;
    }
}
